Skip to content

Simplify CompilerInterface abstraction #10189

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

nicolasstucki
Copy link
Contributor

@nicolasstucki nicolasstucki commented Nov 5, 2020

Make the abstraction be directly on Expr and Type as those are the operations that they expose.

@nicolasstucki nicolasstucki force-pushed the simplify-compiler-interface-abstraction branch from 14c3718 to 5cc810e Compare November 5, 2020 15:52
@nicolasstucki nicolasstucki self-assigned this Nov 5, 2020
@nicolasstucki nicolasstucki marked this pull request as ready for review November 5, 2020 20:23
Copy link
Contributor

@liufengyun liufengyun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM


object reflect extends scala.tasty.Reflection, scala.internal.tasty.CompilerInterface:
object reflect extends scala.tasty.Reflection:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are three concepts here:

  • CompilerInterface
  • Reflection
  • QuoteContext

The responsibility for QuoteContext is relatively clear, it's the facade and it mainly holds API for Type[T] and Expr[T].

It seems there is some overlapping of responsibilities between Reflection and CompilerInterface:

  • CompilerInterface is a contract with the compiler, not the API for meta-programmers
  • Reflection is both the contract with the compiler, and the API for meta-programmers

To continue the refactoring in #9818, it would be nice to make the responsibility of each interface clear and disjoint.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say that this PR also removed the overlapping between Reflection and CompilerInterface as now the CompilerInterface only cares about Expr and Type, but nothing within Reflection.

I will still try to make the internal interaction with CompilerInterface simpler.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say that this PR also removed the overlapping between Reflection and CompilerInterface as now the CompilerInterface only cares about Expr and Type, but nothing within Reflection.

So rename CompilerInterface to QuoteInterface might make things more clear?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would make it clearer.

@nicolasstucki nicolasstucki merged commit 7b5cdba into scala:master Nov 6, 2020
@nicolasstucki nicolasstucki deleted the simplify-compiler-interface-abstraction branch November 6, 2020 13:14
@Kordyjan Kordyjan added this to the 3.0.0 milestone Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants